<!DOCTYPE html>
<html>
  
  <head lang="en">
    <meta charset="UTF-8">
    <title>注册</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="/ho/AmazeUI-2.4.2/assets/css/amazeui.min.css" />
    <link href="/ho/css/dlstyle.css" rel="stylesheet" type="text/css">
    <script src="/ho/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
    <script src="/ho/AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>
  </head>
  
  <body>
    <div class="login-boxtitle">
      <a href="home/demo.html">
        <img alt="" src="/ho/images/logobig.png" /></a>
    </div>
    <div class="res-banner">
      <div class="res-main">
        <div class="login-banner-bg">
          <span></span>
          <img src="/ho/images/big.jpg" /></div>
        <div class="login-box">
          <div class="am-tabs" id="doc-my-tabs">
            <ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
              <li class="am-active">
                <a href="" onclick="$('.one').css('display','none')">邮箱注册</a></li>
                <li onclick="$('.one').css('display','none')"><a href="">手机号注册</a></li>
            </ul>
            
            <div class="am-tabs-bd">

              <div class="am-tab-panel am-active">
                @if(is_object($errors) && count($errors) > 0)
                  <div style="color:red;" class="one" onclick="$(this).css('display','none')">
                    验证失败：
                      <ul>
                          @foreach ($errors->all() as $error)
                              <li>{{ $error }}</li>
                          @endforeach
                      </ul>
                  </div>
              @elseif(is_string($errors))
                <div style="color:red;" class="one" onclick="this.style.display='none'">
                    验证失败：
                      <ul>
                        <li>{{ $errors}}</li>
                      </ul>
                  </div>
              @endif
                <form method="post" action="/home/register/index">
                	{{ csrf_field() }}
                  <div class="user-email">
                    <label for="email">
                      <i class="am-icon-envelope-o"></i>
                    </label>
                    <input type="email" name="uemail" id="email" placeholder="请输入邮箱账号" value="{{ old('uemail')}}"></div>
                    <div id='ajax'></div>
                  <div class="user-pass">
                    <label for="password">
                      <i class="am-icon-lock"></i>
                    </label>
                    <input type="password" name="upassword" id="password" placeholder="设置密码"></div>
                  <div class="user-pass">
                    <label for="passwordRepeat">
                      <i class="am-icon-lock"></i>
                    </label>
                    <input type="password" name="urepassword" id="passwordRepeat" placeholder="确认密码"></div>
                     <div class="am-cf">
                  <input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl"></div>
                </form>
                    <a href="/home/login" style="color:blue;text-decoration:underline;">已有账号？点此登录</a>
              </div>


              <div class="am-tab-panel">
              
              @if(is_object($errors) && count($errors) > 0)
                  <div style="color:red;" class="one" onclick="$(this).css('display','none')">
                    验证失败：
                      <ul>
                          @foreach ($errors->all() as $error)
                              <li>{{ $error }}</li>
                          @endforeach
                      </ul>
                  </div>
              @elseif(is_string($errors))
                <div style="color:red;" class="one" onclick="this.style.display='none'">
                    验证失败：
                      <ul>
                        <li>{{ $errors}}</li>
                      </ul>
                  </div>
              @endif
                <form method="post" action="/home/register/phone">
                  {{ csrf_field() }}
                  <div class="user-phone">
                    <label for="phone">
                      <i class="am-icon-mobile-phone am-icon-md"></i>
                    </label>
                    <input type="tel" name="uphone" id="phone" placeholder="请输入手机号" value="{{ old('uphone')}}"></div>
                    <div id='ajaxphone'></div>
                  <div class="verification">
                    <label for="code">
                      <i class="am-icon-code-fork"></i>
                    </label>
                    <input type="tel" name="uphonecode" id="code" placeholder="请输入验证码">
                    <a class="btn" href="javascript:void(0);" onclick="sendMobileCode();" id="sendMobileCode">
                      <button id="dyMobileButton" disabled onclick="return false">获取</button></a>
                  </div>
          <script type="text/javascript">
          function sendMobileCode(){
            $.get('/home/register/phonecode',{'phone':$('#phone').val()},function(msg){
              if(msg == 2){
                alert('发送成功');
                countdown()
              }else if(msg==1){
                alert('请勿重复发送');
              }else{
                alert('发送失败');
              }
            });
          }

            function countdown(){
              document.getElementById("dyMobileButton").setAttribute("disabled", true);
              var i = 60;
              var intervalid;
              intervalid = setInterval(function(){
                  i--;
                  document.getElementById("dyMobileButton").innerHTML = i+'s';
                  if(i == 0){
                      clearInterval(intervalid);
                       document.getElementById("dyMobileButton").innerHTML = '获取';
                  }
             }, 1000);
           }

          </script>
                  <div class="user-pass">
                    <label for="password">
                      <i class="am-icon-lock"></i>
                    </label>
                    <input type="password" name="upassword" id="password" placeholder="设置密码"></div>
                  <div class="user-pass">
                    <label for="passwordRepeat">
                      <i class="am-icon-lock"></i>
                    </label>
                    <input type="password" name="urepassword" id="passwordRepeat" placeholder="确认密码"></div>
                    <div class="am-cf">
                    <input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl"></div>
                </form>
                      <a href="/home/login" style="color:blue;text-decoration:underline;">已有账号？点此登录</a>
                <hr>
              <script>$(function() {
                  $('#doc-my-tabs').tabs();
                })</script>
            </div>
              </div>
          </div>
        </div>
      </div>
      <div class="footer ">
        <div class="footer-hd ">
          <p>
            <a href="# ">恒望科技</a>
            <b>|</b>
            <a href="# ">商城首页</a>
            <b>|</b>
            <a href="# ">支付宝</a>
            <b>|</b>
            <a href="# ">物流</a></p>
        </div>
        <div class="footer-bd ">
          <p>
            <a href="# ">关于恒望</a>
            <a href="# ">合作伙伴</a>
            <a href="# ">联系我们</a>
            <a href="# ">网站地图</a>
            <em>© 2015-2025 Hengwang.com 版权所有</em></p>
        </div>
      </div>
      <script>
          $('#email').blur(function(){
            var preg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/ ;
            var str = $(this).val();
            if(preg.test(str)){
              $.get('/home/register/ajax',{'email':$(this).val()},function (msg){
                if(msg==1){
                  $('#ajax').text('邮箱已存在').css('color','red');
                }else{
                  $('#ajax').text('邮箱可用').css('color','green');
                }
              });
            }else{
              $('#ajax').text('邮箱格式有误').css('color','red');
            }
          });

          $('#phone').blur(function(){
            var preg = /^1[34578]\d{9}$/ ;
            var str = $(this).val();
            if(preg.test(str)){
              $.get('/home/register/ajaxphone',{'uphone':$(this).val()},function (msg){
                if(msg==1){
                  $('#ajaxphone').text('手机号已存在').css('color','red');
                  $('#dyMobileButton').attr('disabled','disabled');
                }else{
                  $('#ajaxphone').text('手机号可用').css('color','green');
                  $('#dyMobileButton').removeAttr('disabled');
                }
              });
            }else{
              $('#ajaxphone').text('手机格式有误').css('color','red');
               $('#dyMobileButton').attr('disabled','disabled');
            }
          })
      </script>
  </body>

</html>